<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:include="include :: header('修改巷道')"/>
	<style>
		[v-cloak] {
			display: none;
		}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-shelfInfo-edit" th:object="${shelfInfo}">
            <input id="shelfId" name="shelfId" th:field="*{shelfId}" type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">巷道编码：</label>
				<div class="col-sm-8">
					<input id="shelfCode" name="shelfCode" th:field="*{shelfCode}" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">巷道名称：</label>
				<div class="col-sm-8">
					<input id="shelfName" name="shelfName" th:field="*{shelfName}" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">排：</label>
				<div class="col-sm-8">
					<input id="shelfRow" name="shelfRow" th:field="*{shelfRow}" class="form-control" type="number" required>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">列：</label>
				<div class="col-sm-8">
					<input id="shelfColumn" name="shelfColumn" th:field="*{shelfColumn}" class="form-control" type="number" required>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="memo" name="memo" th:field="*{memo}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">货区：</label>
				<div class="col-sm-8">
					<select id="areaId" name="areaId" class="form-control" v-model="checkArea">
						<option v-for="area in areas" :value="area.areaId" v-cloak>{{area.areaName}}</option>
					</select>
				</div>
			</div>
		</form>
		<form th:object="${shelfInfo}">
			<input id="checkArea" th:field="*{areaId}" type="hidden">
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/shelfInfo";

		function submitHandler(){
	        if($.validate.form()){
	            $.operate.save(prefix + "/edit", $('#form-shelfInfo-edit').serialize());
	        }
	    }

	    var app = new Vue({
			el: '.wrapper',
			data: {
				areas: [],
				checkArea: ''
			},
			methods:{
				getAreas: function(){
					var that = this;
					$.ajax({
						cache: true,
						type: "POST",
						url: "/system/areaInfo/list",
						data: {},
						async: false,
						error: function(request){
							$.modal.alertError("系统错误");
						},
						success: function(data){
							that.areas = data.rows;
						}
					});
				}
			},
			created(){
				this.getAreas();
				this.checkArea = document.getElementById('checkArea').value;
			}
		})
	</script>
</body>
</html>